All Questions
188 questions
-2votes
3answers
105views
Given an array of numbers(arr) and the length of the array(n) as arguments, how do you create a tribonacci sequence?
Consider: function tribonacci(arr, n){ let sum = 0; for(let i= arr.length-1; i > arr.length-4; i--){ sum += arr[i] } while(arr.length < n){ arr.push(sum); }...
0votes
1answer
43views
How to to loop through portion of Array in Swift
I want to loop through a portion of an Array in Swift, not the entire array based on the index. The array is coming from an API so I don't know the number of elements in advance. For example for the ...
0votes
1answer
178views
c programming grocery calculator
float calculateTotalCost(float*itemCosts, int itemCount); int main() { int itemCount = 0; float itemCosts[50]; char itemName[50]; char choice; printf("Welcome to Grocery Shop\...
0votes
0answers
20views
How can i use looping from 2 file txt?
I have 2 file .txt that i want to use for looping backup database. File 1 is database name = DB_NAME.txt db_abc db_def File 2 is table name = TB_NAME.txt tb_123 tb_456 tb_789 i want to use it to /...
0votes
0answers
134views
Assign array values without specific index
I'm a beginner who wants to try Java programming, I've got a problem when I want to add a value to arrays (that has been instantiated before) without inputting the specific index public void readData()...
1vote
3answers
527views
unshift and push inside a loop in Javascript, infinite loop javascript
I'm a beginner student and I'm try to get some information from "user" using the prompt() function, and then throw this information in an array. I need to use the loop FOR and the WHILE to ...
0votes
1answer
53views
Code not stopping even with while loop PYTHON
Im trying to get the user to input 8 times,and after that I'm printing out the array. But the while loop doesn't seem to be stopping for some reason ? Here's my code: from numpy import* t = array([int(...
0votes
1answer
39views
Get the maximum Count of a range of values in an Array in C#
I have this array. If the minimum Value is defined as 22, I want the get the maximum number of integers that are next to each other that are higher than 22. For example, here 22 and 23 and higher or ...
0votes
1answer
85views
Learning C basics and need some help:
Basically, I'm trying to create a program where you can read up to 100 inputs from the keyboard. The inputs must be numbers between [1,100] and when "0" is entered, the program exits the ...
-1votes
1answer
288views
How to calculate the ticket price
First of all, this is my assignment question, and I was totally struggling for 2 weeks. If I want to calculate the ticket price, but the first three ticket price is 50, and the subsequence ticket is ...
0votes
2answers
50views
Why does this c program not end when entered 0?
It keeps on asking for integers whether I put 0 or not. I don't know the way to end it. I appreciate it if you do help me. Thanks. I edited the code due to some basic mistakes. #include <stdio.h>...
-1votes
1answer
2kviews
Dynamic bootstrap cards with javascript
I have here a json file and this content should get rendered inside of bootstrap cards. [{ "scripts": { "web3py": [ { "thumbnail": ...
1vote
3answers
158views
triangle Number pattern using loop in javasctipt
Hello I'm having a problem. I want to create a triangular number pattern as follows: Output: 1223334444333221 =22333444433322= ===3334444333=== ======4444====== I've tried to make the ...
-3votes
2answers
46views
For loop / While proble [closed]
Hi I'm trying to solve this problem: "For any number code the next series:" n = any number (1 for this case) 1,2,6,24,120,720... This series is: 1x1 = 1 1x2 = 2 2x3 = 6 6x4 = 24 24x5 = 120 ...
-1votes
1answer
43views
How to turn while-loops into for-loops?
How can I formulate these while loops into for loops? I think for loops are nicer looking and want to get rid of these while loops. How do I do that? I have no clue. number_of_vertices = ...